package cn.wen233.basic.model;

import cn.wen233.basic.utils.IdUtils;
import lombok.Data;

import java.nio.charset.StandardCharsets;
import java.util.Objects;

/**
 * 服务实例 实体
 *
 * @author wenei
 * @date 2021-10-09 21:09
 */
@Data
public class Instance {

    private String id;

    private String ip;

    private int port;

    private String serviceName;

    private String serviceId;

    private boolean enabled;

    /**
     * 状态
     * 0、正常
     */
    private Integer status;

    public Instance() {
        this.id = String.valueOf(IdUtils.snowId());
    }

    public Instance(Instance instance) {
        this.id = instance.getId();
        this.ip = instance.getIp();
        this.port = instance.getPort();
        this.serviceName = instance.getServiceName();
        this.serviceId = instance.getServiceId();
        this.enabled = instance.isEnabled();
        this.status = instance.status;
    }
}
